using DevelopmentKit.Cms.Domain;
using FluentNHibernate.Automapping;
using FluentNHibernate.Automapping.Alterations;

namespace DevelopmentKit.Cms.Infrastructure.NHibernateMaps
{
    public class DefinitionMap : IAutoMappingOverride<Definition>
    {
        public void Override(AutoMapping<Definition> mapping)
        {
            mapping.HasMany(x => x.Propertys).Cascade.AllDeleteOrphan();
            mapping.HasManyToMany(x => x.AllowChildrenDefinitions).ParentKeyColumn("DefinitionId").ChildKeyColumn("AllowId").Cascade.SaveUpdate();
        }
    }
}